package com.ts.api.http.receive.biz;

import com.gitee.apanlh.util.algorithm.encrypt.symmetric.AES;
import com.gitee.apanlh.util.cache.redis.RedisKeyBuilder;
import com.gitee.apanlh.util.cache.redis.api.RedisString;
import com.gitee.apanlh.util.encode.Base64Utils;
import com.gitee.apanlh.web.model.vo.RequestVO;
import com.ts.api.module.api.convert.core.annotation.ApiReceive;
import com.ts.api.module.api.convert.core.annotation.ApiReceiveConvertType;
import com.ts.api.module.api.convert.receive.entity.ApiReceiveDecrypt;

import java.util.Map;

/**
 * 有钱来全流程
 *
 * @author WJB
 */
@ApiReceive(apiClientId = "1969053262619234304", type = ApiReceiveConvertType.API_CHANNEL_PHONE_MASK)
public class ApiReceiveMaskYouQianLai28 extends ApiReceiveMaskYouQianLai {

    public static final String KEY = "zueWeHAVMj8uuMgjVNn29w==";
    public static final String IV = "zueWeHAVMj8uuMgjVNn29w==";

    public static final RedisString ORDER_NO = RedisKeyBuilder.builder().withKeys("temp_you_qian_lai").buildString();

    @Override
    public ApiReceiveDecrypt decrypt(Map<String, String> paramMap, RequestVO requestVO) throws Exception {
        String params = paramMap.get("params");

        //  文档解密过程
        AES cbc = AES.createCbc(Base64Utils.decode(KEY), Base64Utils.decode(IV));
        String decrypt = cbc.decryptFromBase64Str(params);
        return new ApiReceiveDecrypt(decrypt);
    }

}
